const { createProxyMiddleware } = require("http-proxy-middleware"); // 代理服务中间件
module.exports = function (app) {
  // 代理服务器地址
  app.use(
    createProxyMiddleware("/proxy", {
      target: "http://localhost:6002",
      secure: false,
      changeOrigin: true,
      pathRewrite: {
        "^/proxy": "",
      },
    })
  );
  // app.use(
  //   createProxyMiddleware("/proxy_ws", {
  //     // target: "http://192.168.11.119:5005",
  //     target: "http://cn-fz-dx.sakurafrp.com:36292",
  //     ws:true,
  //     secure: false,
  //     changeOrigin: true,
  //     pathRewrite: {
  //       "^/proxy_ws": "",
  //     },
  //   })
  // );

  app.get("/getuserinfo", (req, res) => {
    console.log('客户端登录',req.query);
    res.send({
      code: 200, // 业务请求返回码
      mes: "成功", // 信息
      status: "success",
      data: {
        name: "rdj",
        sex: "男",
        phone: "18202074132",
        mail: "466865572@qq.com",
        address: "萝岗科学城",
        note:"无用数据"
      },
    });
  });
};
